home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: uhura.cc.rochester.edu!sc006e
- From: sc006e@uhura.cc.rochester.edu (Scott Crosby)
- Subject: Re: Template Troubles
- Message-ID: <1996Feb26.174908.25284@galileo.cc.rochester.edu>
- Sender: news@galileo.cc.rochester.edu
- Nntp-Posting-Host: uhura.cc.rochester.edu
- Organization: University of Rochester - Rochester, New York
- References: <4grbtb$nog@aimnet.aimnet.com>
- Distribution: usa
- Date: Mon, 26 Feb 96 17:49:08 GMT
-
- In <4grbtb$nog@aimnet.aimnet.com> krisb@aimnet.com (Kris Bosland) writes:
-
- > I have just discovered Templates in C++, and I am trying to use them
- >for the same thing that everyone else uses them for: Linked Lists. I am
- >trying to get even a basic template class going, and it is not working. I am
- >running g++ 2.7.0 on my Linux 1.2.13 system (vanilla Slackware 3.0). Files:
-
- >test.cc:
- >----------------------------------------------------------------
- >template <class data_t> class List {
- > public:
- > data_t data;
- >} ;
- ^^^
- ***** I think you need a semicolon here |
-
- >void main( int argc, char **argv )
- >{
- > List<char *> string_list;
-
- >}
- >----------------------------------------------------------------
-
- >Compiler Results:
- >----------------------------------------------------------------
- >g++ -g -o test test.cc
- >test.cc:7: parse error before `void'
- >test.cc:9: confused by earlier errors, bailing out
- >make: *** [test] Error 1
- >----------------------------------------------------------------
-
- > Could I be missing some compiler flags or configuration? I don't have
- >much experience customizing gcc/g++. In a more complicated file I wrote, I
- >got errors complaining about incomplete typing of the data member of my class.
-
-
-
- > -Kris Bosland
- > krisb@aimnet.com
- > http://www.seattleu.edu/~krisb/
- --
- *************************************************************************
- * Scott Crosby *
- * sc006e@uhura.cc.rochester.edu *
- *************************************************************************
-